package com.chain.BrotherExchange.data.model;

import com.chain.BrotherExchange.R;

import java.util.List;

public class CoinOrderList extends BaseResponseModel<CoinOrderList.DataBean> {


    public static class DataBean {
        private List<ListBean> list;

        public DataBean() {
        }

        public DataBean(List<ListBean> list) {

            this.list = list;
        }

        public List<ListBean> getList() {
            return list;
        }

        public void setList(List<ListBean> list) {
            this.list = list;
        }

        public static class ListBean {
            public ListBean() {
            }

            public ListBean(
                     String symbol, int opt, String all_num, String on_price,
                    String trade_num, int states, String create_time, String sum, String price
            ) {

                this.symbol = symbol;
                this.opt = opt;
                this.all_num = all_num;
                this.on_price = on_price;
                this.trade_num = trade_num;
                this.states = states;
                this.create_time = create_time;
                this.sum = sum;

                this.price = price;
            }

            /**
             * entrust_id : 1540867276_2
             * symbol : ETH/SDC
             * opt : 1
             * type : 2
             * all_num : 0.222
             * on_price : 0.222
             * trade_num : 0
             * states : 4
             * create_time : 2018-10-30 10:41:16
             * sum : 1
             * price : 0
             */

            private String entrust_id;
            private String symbol;
            private int opt;
            private int type;
            private String all_num;
            private String on_price;
            private String trade_num;
            /**
             * 4是挂单 1是部分成交 2成交 撤销
             */
            private int states;
            private String create_time;
            private String sum;
            private String price;


            public String getEntrustSymbol() {
                return symbol.split("/")[0];
            }

            public String getPurchaseSymbol() {
                return symbol.split("/")[1];
            }

            public String getEntrust_id() {
                return entrust_id;
            }

            public void setEntrust_id(String entrust_id) {
                this.entrust_id = entrust_id;
            }

            public String getSymbol() {
                return symbol;
            }

            public void setSymbol(String symbol) {
                this.symbol = symbol;
            }

            public int getOpt() {
                return opt;
            }

            public void setOpt(int opt) {
                this.opt = opt;
            }

            public int getType() {
                return type;
            }

            public void setType(int type) {
                this.type = type;
            }

            public String getAll_num() {
                return all_num;
            }

            public void setAll_num(String all_num) {
                this.all_num = all_num;
            }

            public String getOn_price() {
                return on_price;
            }

            public void setOn_price(String on_price) {
                this.on_price = on_price;
            }

            public String getTrade_num() {
                return trade_num;
            }

            public void setTrade_num(String trade_num) {
                this.trade_num = trade_num;
            }

            public int getStates() {
                return states;
            }

            public int getStatesText() {
                switch (states) {
                    case 1:
                        return R.string.partial_deal;
                    case 2:
                        return R.string.clinch_deal;
                    case 3:
                        return R.string.recall;
                    default:
                        return R.string.entry_orders;
                }
            }

            public boolean isCancel() {
                return states == 1 || states == 4;
            }

            public void setStates(int states) {
                this.states = states;
            }

            public String getCreate_time() {
                return create_time;
            }

            public void setCreate_time(String create_time) {
                this.create_time = create_time;
            }

            public String getSum() {
                return sum;
            }

            public void setSum(String sum) {
                this.sum = sum;
            }

            public String getPrice() {
                return price;
            }

            public void setPrice(String price) {
                this.price = price;
            }

            public int getDirection() {
                return opt == 1 ? R.string.buying : R.string.sale;
            }
        }
    }
}
